package main.java.FSMDE.validation.rules;

import java.util.ArrayList;
import java.util.List;

import main.java.FSMDE.models.Diagram;
import main.java.FSMDE.models.Transition;
import main.java.FSMDE.validation.IValidationEntry;
import main.java.FSMDE.validation.rules.IRulesValidator;


public class TransitionWithoutDestinationValidator implements IRulesValidator {

	@Override
	public Iterable<IValidationEntry> validate(Diagram diagram) {
		List<IValidationEntry> entries = new ArrayList<IValidationEntry>();

		// Control transitions must have a Component Trigger
		for(Transition transition : diagram.getTransitions()){
			if( transition.getDestination() == null ) entries.add(new TransitionWithoutDestinationValidationEntry(diagram, transition));
		}
		
		return entries;
	}

}
